<?php

	require_once "Zend/Json.php";
	$page   = $_POST["page"];
	$pageid = $_POST["id"];
	
	$plugins -> page -> setPageModificationType( $page );
	$pagedata = $plugins -> page -> getPageById( $pageid );
	
	$pagename = ucfirst($pagedata->name);
	
	$data = array(
	"status"  => "true",
	"message" => "Data has been successfully loaded! Closing in 2 seconds...",
	"content" => "
				<div class=\"box\">
					<h1>Permissions. Groups, users or shortly user access settings for \".$pagename.\" page</h1>
					<hr />
					<p  class=\"validmessage\" id=\"validmessage\">
					Permissions are used for defining access for each user or entire group. For example, you don't want
					that X user see this page. If that's the case, than you can find him and disable access for that user.
					Please don't rush, spend time on reading
					<a href=\"#\" title=\"#\">manual</a> and I'm sure that you will not mistake. 
					Building page isn't hard. It's quite easy but still you can make mistake what will result
					that page acts differently that you expect!</p>
				</div>
				<form action=\"#\" name=\"managepage_form\" id=\"managepage_form\" enctype=\"multipart-form-data\">
				<ul>
					<li>
						<h3>Permissions status</h3>
						<p>If you wish to, you can completely disable permissions for this page by selecting disabled. Default is enabled!</p>
						<select name=\"permissionstatus\" id=\"permissionstatus\">
							<option value=\"true\" selected=\"selected\">Enabled</option>
							<option value=\"false\">Disabled</option>
						</select>
					</li>
				</ul>
				
				<ul class=\"listning-tablelike\">
					<map name=\"selall\"></map>
					<li class=\"theader\">
							
						<div class=\"searchbox\">
							<h2>Search groups</h2>
							<p>Search them by username, group name or by creation date</p>
							<input type=\"text\" id=\"searchgroups\" name=\"searchgroups\" />
						</div>
					
						<h5>Group permissions</h5>
						
						<ul>
							<li id=\"selectall\">Id ( <a href=\"#selall\" title=\"#\">Select All</a> ) 
							   <img id=\"byid\" src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Group name
								<img id=\"byname\" 
								src=\"".$plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Group status
								<img id=\"bystatus\" 
								src=\"".$plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								View page
								<img id=\"byview\" 
								src=\"".$plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Edit page
								<img id=\"byedit\" 
								src=\"".$plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li class=\"last\">
								<img id=\"bydelete\" 
								src=\"".$plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />Delete page
							</li>
						</ul>
					</li>
				</ul>
				
				<!-- This one.... Lazy mother fuker! Dun want to listen me... Lets go celebrate the pussy, but if it's harry i go straight
				     back to tits! -->
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 01</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 02</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 03</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 04</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 05</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 06</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				
				
				<!-- USER GROUPS AREA -->
				<ul class=\"listning-tablelike\">
					<map name=\"selall\"></map>
					<li class=\"theader\">
							
						<div class=\"searchbox\">
							<h2>Search users</h2>
							<p>Search them by username, group name or by joining date</p>
							<input type=\"text\" id=\"searchgroups\" name=\"searchgroups\" />
						</div>
					
						<h5>Group permissions</h5>
						
						<ul>
							<li id=\"selectall2\">Id ( <a href=\"#selall\" title=\"#\">Select All</a> ) 
							   <img id=\"byid2\" src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Group name
								<img id=\"byname2\" 
								src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Group status
								<img id=\"bystatus2\" 
								src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								View page
								<img id=\"byview2\" 
								src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li>
								Edit page
								<img id=\"byedit2\" 
								src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />
							</li>
							<li class=\"last\">
								<img id=\"bydelete2\" 
								src=\"". $plugins -> css -> getCssPath()."/elements/state_changer_tablelike.png\" alt=\"#\" />Delete page
							</li>
						</ul>
					</li>
				</ul>
				
				<!-- This one.... Lazy mother fuker! Dun want to listen me... Lets go celebrate the pussy, but if it's harry i go straight
				     back to tits! -->
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 01</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 02</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 03</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 04</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 05</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				<ul class=\"tablelike-rows\">
					<li><input type=\"checkbox\" name=\"ilikerabbits[]\"/> 06</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li>Allowed</li>
					<li class=\"last\">Allowed</li>
				</ul>
				</form>"
	);
	
	echo Zend_Json::encode($data);